package com.hmall.api.cart;

import com.hmall.api.cart.domain.dto.CartFormDTO;

import com.hmall.api.cart.domain.po.Cart;
import com.hmall.api.cart.domain.vo.CartVO;

import feign.Param;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * TODO
 *
 * @Date 2025/11/9/周日 22:22
 */
@FeignClient(name = "cart-service",path = "/carts")
public interface CartClient {

    @ApiOperation("添加商品到购物车")
    @PostMapping
    public void addItem2Cart(@Valid @RequestBody CartFormDTO cartFormDTO);

    @ApiOperation("更新购物车数据")
    @PutMapping
    public void updateCart(@RequestBody Cart cart);

    @ApiOperation("删除购物车中商品")
    @DeleteMapping("{id}")
    public void deleteCartItem(@Param("购物车条目id")@PathVariable("id") Long id);

    @ApiOperation("查询购物车列表")
    @GetMapping
    public List<CartVO> queryMyCarts();

    @ApiOperation("批量删除购物车中商品")
    @ApiImplicitParam(name = "ids", value = "购物车条目id集合")
    @DeleteMapping
    public void deleteCartItemByIds(@RequestParam("ids") List<Long> ids);

}